package servlets;

import java.io.IOException;
import java.io.PrintWriter;

public class loginServlet extends javax.servlet.http.HttpServlet {
    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        String usr, pwd;
        PrintWriter out = response.getWriter();
        usr = request.getParameter("username");
        pwd = request.getParameter("password");
        if (usr.equals("Sev") && pwd.equals("123")) {
            out.print("{'state': 'true', 'url': 'index.html?username=" + usr + "'}");
            //response.sendRedirect("/MyWebsite/index.jsp");
        } else
            out.print("{'state': 'false'}");
    }

    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {

    }
}
